<?php

namespace App\Http\Controllers\Api;

use App\Models\MsgBoard;
use App\Models\Tag;
use Illuminate\Http\Request;

class NewTagsController extends Controller
{
    public function list(int $type)
    {
        if (!in_array($type, [1, 2, 3])) return $this->error('类型错误');

        $list = Tag::where([
            'type'      => $type,
            'mini_type' => $this->getMiniType(),
            'status'    => 1,
        ])->orderByDesc('sort')->orderByDesc('id')->get(['id', 'name']);

        return $this->_success([
            'list' => $list
        ]);
    }
}
